package entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@NamedNativeQueries({	
	@NamedNativeQuery(name="getContasBancarias", query = "select * from conta_banco "
												  + "where id_usuario = :id_usuario ", resultClass = ContaBancoENT.class),
  @NamedNativeQuery(name="getContaBanco", query = "select * from conta_banco "
												  + "where id = :id ", resultClass = ContaBancoENT.class)												  
})

@Entity
@Table(name="conta_banco")
public class ContaBancoENT  implements Serializable{
/*------------------------------------------------------------------------------------*/	
	private static final long serialVersionUID = -808613820685994431L;
	@Id
	@GeneratedValue
	private int id;
	
	@Column(name="nr_conta",nullable = false)
	private String nrConta;
	
	@Column(name="nr_agencia",nullable = false)	
	private String nrAgencia;
	
	@Column(name="nome_banco",nullable = false)	
	private String nomeBanco;
	
	@Column(name="data_alteracao",nullable = false)
	@Temporal(TemporalType.TIMESTAMP)		
	private Date dtAlteracao;	
	
	
	@ManyToOne
	@JoinColumn(name="id_usuario",nullable = false)
	private UsuarioENT usuario;
	
	@Column(name="popupanca")
	private Boolean poupanca;
	
	@Column(name="limite_conta",nullable = false, length = 4 ,precision = 2)
	private Double limiteConta;
/*------------------------------------------------------------------------------------*/

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNrConta() {
		return nrConta;
	}

	public void setNrConta(String nrConta) {
		this.nrConta = nrConta;
	}

	public String getNrAgencia() {
		return nrAgencia;
	}

	public void setNrAgencia(String nrAgencia) {
		this.nrAgencia = nrAgencia;
	}

	public String getNomeBanco() {
		return nomeBanco;
	}

	public void setNomeBanco(String nomeBanco) {
		this.nomeBanco = nomeBanco;
	}

	public Date getDtAlteracao() {
		return dtAlteracao;
	}

	public void setDtAlteracao(Date dtAlteracao) {
		this.dtAlteracao = dtAlteracao;
	}

	public UsuarioENT getUsuario() {
		return usuario;
	}

	public void setUsuario(UsuarioENT usuario) {
		this.usuario = usuario;
	}

	public Boolean getPoupanca() {
		return poupanca;
	}

	public void setPoupanca(Boolean poupanca) {
		this.poupanca = poupanca;
	}

	public Double getLimiteConta() {
		return limiteConta;
	}

	public void setLimiteConta(Double limiteConta) {
		this.limiteConta = limiteConta;
	}

	public ContaBancoENT() {
		super();
	}

	
}
